﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;

namespace StartMVC.Models
{
    [DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))]
    public class StartMVCDBContext : DbContext
    {
        public StartMVCDBContext()
            : base("name=DefaultConnection")
        {
           // this.Configuration.ValidateOnSaveEnabled = false;
        }
   //     static StartMVCDBContext()
   //     {
   //         DbConfiguration.SetConfiguration(new MySql.Data.Entity.MySqlEFConfiguration());
   //         Database.SetInitializer<StartMVCDBContext>(
   //new DropCreateDatabaseAlways<StartMVCDBContext>());
   //         //Database.SetInitializer<MvcShoppingContext>(new DropCreateDatabaseIfModelChanges<MvcShoppingContext>());

   //     }
   //     protected override void OnModelCreating(DbModelBuilder modelBuilder)
   //     {
   //         modelBuilder.Conventions.Remove<System.Data.Entity.ModelConfiguration.Conventions.PluralizingTableNameConvention>();
   //         base.OnModelCreating(modelBuilder);
   //     }

        public DbSet<ProductCategory> ProductCategorys { get; set; }
        public DbSet<Product> Products { get; set; }
        public DbSet<Member> Members { get; set; }
        public DbSet<OrderHeader> Orders { get; set; }
        public DbSet<OrderDetail> OrderDetailItems { get; set; }

        public DbSet<MailLog> MailLogs { get; set; }
    }
}